package com.bf.electroplating.controller;

import com.bf.electroplating.pojo.dto.viewAccessDevice.ValveStatusVO;
import com.bf.electroplating.pojo.vo.ResultVO;
import com.bf.electroplating.pojo.vo.viewAccessDeviceList.ViewAccessDeviceCompanyChartVO;
import com.bf.electroplating.pojo.vo.viewAccessDeviceList.ViewAccessDeviceCompanyQueryDTO;
import com.bf.electroplating.pojo.vo.viewAccessDeviceList.ViewAccessDeviceCompanyStatsVO;
import com.bf.electroplating.pojo.vo.viewAccessDeviceList.ViewAccessDeviceTypeQueryDTO;
import com.bf.electroplating.pojo.vo.viewAccessDeviceList.ViewAccessDeviceTypeVO;
import com.bf.electroplating.pojo.vo.viewAccessDeviceList.ViewAccessInstrumentTypeQueryDTO;
import com.bf.electroplating.pojo.vo.viewAccessDeviceList.ViewAccessInstrumentTypeVO;
import com.bf.electroplating.service.IViewAccessDeviceListService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping( "/viewAccessDeviceList" )
@Tag( name = "园区设备控制器", description = "园区设备控制器" )
@Validated
public class ViewAccessDeviceListController {

    @Resource
    private IViewAccessDeviceListService viewAccessDeviceListService;

    @PostMapping("/deviceTypeList")
    @Operation(summary = "设备类型列表", description = "获取园区设备类型列表")
    public ResultVO<List<ViewAccessDeviceTypeVO>> listDeviceTypes() {
        List<ViewAccessDeviceTypeVO> data = viewAccessDeviceListService.listDeviceTypes();
        return ResultVO.ok(data);
    }

    @PostMapping("/instrumentTypeList")
    @Operation(summary = "仪器类型列表", description = "获取指定设备类型下的仪器类型列表")
    public ResultVO<List<ViewAccessInstrumentTypeVO>> listInstrumentTypes(@Valid @RequestBody ViewAccessInstrumentTypeQueryDTO queryDTO) {
        List<ViewAccessInstrumentTypeVO> data = viewAccessDeviceListService.listInstrumentTypes(queryDTO);
        return ResultVO.ok(data);
    }

    @PostMapping("/companyStatistics")
    @Operation(summary = "企业数据统计", description = "获取指定仪器类型下的企业数据统计信息")
    public ResultVO<ViewAccessDeviceCompanyStatsVO> getCompanyStatistics(@Valid @RequestBody ViewAccessDeviceCompanyQueryDTO queryDTO) {
        ViewAccessDeviceCompanyStatsVO data = viewAccessDeviceListService.getCompanyStatistics(queryDTO);
        return ResultVO.ok(data);
    }

    @PostMapping("/companyChart")
    @Operation(summary = "企业数据图表", description = "获取指定仪器类型下的企业图表数据")
    public ResultVO<List<ViewAccessDeviceCompanyChartVO>> listCompanyChart(@Valid @RequestBody ViewAccessDeviceCompanyQueryDTO queryDTO) {
        List<ViewAccessDeviceCompanyChartVO> data = viewAccessDeviceListService.listCompanyChart(queryDTO);
        return ResultVO.ok(data);
    }

    @PostMapping("/valveStatus")
    @Operation(summary = "闸阀状态", description = "闸阀状态")
    public ResultVO<ValveStatusVO> valveStatus(@Valid @RequestBody ViewAccessDeviceCompanyQueryDTO queryDTO) {
        ValveStatusVO data = viewAccessDeviceListService.valveStatus(queryDTO);
        return ResultVO.ok(data);
    }
}
